Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(psl): GA fullTextSearch for mysql, introduce nativeFullTextSearchPostgres for postgres #5055

Merged
merged 15 commits into from
Nov 27, 2024

Conversation

jkomyno
Copy link
Contributor

@jkomyno jkomyno commented Nov 26, 2024

This PR:


This is the first time we GA a preview feature for a a subset of every Prisma-supported connector, while also renaming a preview feature for a specific connector:

  • we're only GA-ing fullTextSearch for provider = "mysql", but psl_core::common::preview_features::FeatureMap has no knowledge of which Prisma database provider is currently selected by the user
  • we're renaming fullTextSearch as nativeFullTextSearchPostgres for provider = "postgresql" only

Hence, I've introduced psl_core::common::preview_features::FeatureMapWithProvider::<'a>, which, given a provider, exposes the same functionality as the old FeatureMap, but allows for escape hatches when provider = "mysql". FeatureMap is now a private struct.

I've added a default implementation of FeatureMapWithProvider as a convenience for https://github.com/prisma/language-tools, which is selected when the datasource block doesn't yet have a valid provider value.

The FeatureMap struct now has two new fields:

  • native: BTreeMap<&'static str, PreviewFeatures>, which lists the valid connector-specific features. It's a map from database provider to the set of native preview features.
  • renamed: BTreeMap<RenamedFeatureKey, RenamedFeatureValue>, which keeps track of the renamed deprecated issues. It's a map from a deprecated preview feature and an optional database provider to the new, active preview feature, along with information useful for diagnostic messages.

Both map entries are feature-gated at compile-time. Since BTreeMap insertion isn't const-initialisable, I had to move the FeatureMap instantiation into FeatureMapWithProvider::new, while also introducing std::sync::LazyLock for ALL_PREVIEW_FEATURES, the default FeatureMapWithProvider value.


  • When on provider = "mysql", writing previewFeatures = ["fullTextSearch"] in schema.prisma now results in the following validation warning:
    Preview feature "fullTextSearch" is deprecated. The functionality can be used without specifying it as a preview feature.
    
  • When on provider = "postgres" / provider = "postgresql", writing previewFeatures = ["fullTextSearch"] in schema.prisma now results in the following validation warning:
    On `provider = "postgresql"`, preview feature "fullTextSearch" has been renamed to "fullTextSearchPostgres". Learn more at https://pris.ly/d/fts-postgres.
    
  • When on provider = "postgres" / provider = "postgresql", writing previewFeatures = ["fullTextSearchPostgres"] in schema.prisma is now valid.

… rename it to "nativeFullTextSearchPostgres" for Postgres
@jkomyno jkomyno requested a review from a team as a code owner November 26, 2024 11:10
@jkomyno jkomyno requested review from aqrln and removed request for a team November 26, 2024 11:10
Copy link

codspeed-hq bot commented Nov 26, 2024

CodSpeed Performance Report

Merging #5055 will not alter performance

Comparing feat/ga-fullTextSearch (4fb9f34) with main (4180c29)

Summary

✅ 11 untouched benchmarks

Copy link
Contributor

github-actions bot commented Nov 26, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.049MiB 2.044MiB 5.475KiB
Postgres (gzip) 821.962KiB 820.491KiB 1.472KiB
Mysql 2.013MiB 2.010MiB 3.264KiB
Mysql (gzip) 807.725KiB 806.709KiB 1.017KiB
Sqlite 1.910MiB 1.907MiB 3.285KiB
Sqlite (gzip) 768.146KiB 766.292KiB 1.854KiB

@jkomyno jkomyno added this to the 6.0.0 milestone Nov 26, 2024
@jkomyno jkomyno force-pushed the feat/ga-fullTextSearch branch from cbf597e to 819f55e Compare November 26, 2024 16:24
@jkomyno jkomyno force-pushed the feat/ga-fullTextSearch branch from 776d2db to 09dc081 Compare November 26, 2024 20:13
psl/psl-core/src/common/preview_features.rs Show resolved Hide resolved
psl/psl-core/src/common/preview_features.rs Outdated Show resolved Hide resolved
psl/psl-core/src/common/preview_features.rs Outdated Show resolved Hide resolved
psl/psl-core/src/common/preview_features.rs Outdated Show resolved Hide resolved
psl/psl-core/src/common/preview_features.rs Outdated Show resolved Hide resolved
psl/psl-core/src/common/preview_features.rs Outdated Show resolved Hide resolved
psl/psl-core/src/common/preview_features.rs Outdated Show resolved Hide resolved
psl/diagnostics/src/warning.rs Outdated Show resolved Hide resolved
psl/diagnostics/src/warning.rs Outdated Show resolved Hide resolved
Copy link
Member

@aqrln aqrln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@jkomyno jkomyno merged commit c1f5600 into main Nov 27, 2024
367 checks passed
@jkomyno jkomyno deleted the feat/ga-fullTextSearch branch November 27, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants